package com.threadpool;


import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class TestThreadpool {
    public static  void main(String [] args)
    {
        ExecutorService fixPool = Executors.newFixedThreadPool(5);
        for(int i=0;i<10;i++)
        {
            fixPool.execute(new Thread(new Runnable() {
                public void run() {
                    System.out.println(Thread.currentThread().getName()+"输出");
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }));

        }

/*        Thread td1= new Thread(new Runnable() {
            public void run() {
                System.out.println(Thread.currentThread().getName()+"输出");

            }
        });
        fixPool.execute(td1);*/

    }
}
